package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class CreditCradType extends AbstractData {
	private long id = -1;
	private String CardTypeName;
	private boolean status;
	
	public CreditCradType()
	{
		status = true;
	}
	
	public CreditCradType(long id){
		this.id = id;
		this.status = true;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getCardTypeName() {
		return CardTypeName;
	}

	public void setCardTypeName(String cardTypeName) {
		CardTypeName = cardTypeName;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	@Override
	public Entity getEntity() {
		Entity item;
		if(this.key == null)
			item = new Entity(EntityName.CreditCardType);
		else
			item = new Entity(this.key);
		item.setProperty("CardTypeName", this.CardTypeName);
		item.setProperty("status", this.status);
		return item;
	}

	@Override
	public void setEntity(Entity entity) {
		this.id = entity.getKey().getId();
		this.CardTypeName = (String) entity.getProperty("CardTypeName");
		this.status = (Boolean) entity.getProperty("status");
		this.key = entity.getKey();
	}
	
	public void LoadData()
	{
		if(this.id > -1)
		{
			Entity entity = LoadData(EntityName.CreditCardType,this.id);
			setEntity(entity);
		}
	}

}
